<template>
	<view class="content">
		<view style="position: relative">
			<view class="header" :style="{ 'padding-top': marTop + 'px' }">
				<text class="headerTitle">送药上门 医保服务</text>
			</view>
			<image v-if="tAdvertInfo.img" class="bg_image" :src="tAdvertInfo.img"></image>
			<image v-else class="bg_image" src="../../static/images/bgImgNew.png"></image>
			<view style="
                            position: relative;
                            width: 80%;
                            margin: 0 auto;
                            bottom: 535rpx;
                        ">
				<view class="inputStyle_border">
					<view style="position: relative">
						<image style="
                                        width: 40rpx;
                                        height: 40rpx;
                                        position: absolute;
                                        left: 29%;
                                        top: 13rpx;
                                    " src="../../static/images/search.png"></image>
						<input placeholder-style="marginLeft:20rpx" class="inputStyle" :disabled="true" type="text"
							@click="medicalList" placeholder="搜索药品" />
					</view>
				</view>
			</view>
		</view>
		<view class="positions">
			<uni-swiper-dot v-if="listData.length > 0 && isLogin" class="uni-swiper-dot-box" @clickItem="clickItem"
				:info="listData" :current="current" :mode="mode" :dots-styles="dotsStyles" field="content">
				<swiper class="image-container" previous-margin="45rpx" next-margin="45rpx" circular @change="change"
					:current="swiperDotIndex">
					<swiper-item class="swiper-items" v-for="(item, index) in listData" :class="
                        swiperDotIndex == index
                            ? 'swiper-item'
                            : 'swiper-item-side'
                    " :key="index">
						<view class="swiper-item" @click="goto('/pages/homePage/doctorPage')">
							<view class="swiperCard" :class="
                                swiperDotIndex == index
                                    ? 'item-img'
                                    : 'item-img-side'
                            ">
								<!-- <view class="title">
                  <text>您的专属健康服务</text>
                  <text style="font-size: 30rpx; margin-left: 20rpx;">
                    守护全家健康
                  </text>
                </view> -->
								<view style="display: flex; height: 230rpx" v-if="item.type == 5">
									<view class="doctorheader">
										<image :src="item.storeLogo" />
									</view>
									<view class="doctorInfo">
										<view style="
                                                        font-size: 33rpx;
                                                        font-weight: bold;
                                                    " class="line2Overflow">
											{{
                                                item.storeName
                                                ? item.storeName
                                                : ''
                                            }}
										</view>
										<view style="margin-top: 5rpx">
											<text>{{
                                                item.doctorName
                                                ? item.doctorName
                                                : ''
                                            }}</text>
											<text style="margin-left: 10rpx">
												{{
                                                    item.storePhone
                                                    ? item.storePhone
                                                    : ''
                                                }}
											</text>
											<!-- <text style="padding: 0 10rpx;">|</text><text>{{item.jobTitle?item.jobTitle:""}}</text> -->
										</view>
										<view style="
                                                        margin-top: 5rpx;
                                                        font-size: 14px;
                                                    " class="gray_font line2Overflow">
											{{
                                                item.storeAddress
                                                ? item.storeAddress
                                                : ''
                                            }}
										</view>
									</view>
								</view>
								<view style="display: flex; height: 230rpx" v-else>
									<view class="doctorheader">
										<image :src="item.icon" />
									</view>
									<view class="doctorInfo">
										<view style="
                                                        font-size: 33rpx;
                                                        font-weight: bold;
                                                    ">
											{{ item.name }}
										</view>
										<view style="margin-top: 5rpx">
											<text>{{
                                                item.deptName
                                                ? item.deptName
                                                : ''
                                            }}</text>
											<text style="padding: 0 10rpx">|</text>
											<text>{{
                                                item.jobTitle
                                                ? item.jobTitle
                                                : ''
                                            }}</text>
										</view>
										<view style="margin-top: 5rpx" class="gray_font">
											{{
                                                item.hospitalName
                                                ? item.hospitalName
                                                : ''
                                            }}
										</view>
									</view>
								</view>
							</view>
						</view>
					</swiper-item>
				</swiper>
			</uni-swiper-dot>
			<view v-else-if="listData.length <= 0 && !isLogin" class="noDateboday">
				<view class="noDate">
					<image src="../../static/images/icon_lack_message@2x.png"></image>
					<view>暂无绑定药店</view>
				</view>
			</view>
			<view v-else-if="!isLogin" class="noDateboday">
				<view class="noDate">
					<image src="../../static/images/icon_lack_message@2x.png"></image>
					<view class="go_login">
						<view>暂无绑定药店</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 有数据 登录了以后 -->
		<view class="" v-if="isLogin">
			<view class="" v-if="listData.length > 0">
				<view v-for="(item, index) in listData" :key="index">
					<view v-if="current == index">
						<view class="service" style="margin-top: -5rpx">
							<view class="icon_line_green"></view>
							<view style="margin-left: 30rpx">药店服务</view>
						</view>
						<view class="servicecard">
							<view style="
                                            display: flex;
                                            justify-content: space-between;
                                        ">
								<view style="display: flex">
									<view>
										<image class="img_icon" src="../../static/images/icon_h_jia@2x.png"></image>
									</view>
									<view class="service_content">
										<view style="margin-top: 5rpx" class="servicetitle">
											用药咨询
										</view>
										<view style="margin-top: 15rpx">24小时用药咨询服务</view>
									</view>
								</view>
								<view>
									<view @click="tofreepage" class="btn_small" style="margin-top: 20rpx">
										去咨询
										<image style="width: 20rpx; height: 20rpx"
											src="../../static/images/write_icon.png"></image>
									</view>
								</view>
							</view>
						</view>
						<view class="servicecard">
							<view style="
                                            display: flex;
                                            justify-content: space-between;
                                        ">
								<view style="display: flex">
									<view>
										<image class="img_icon" src="../../static/images/icon_h_shen@2x.png"></image>
									</view>
									<view class="service_content">
										<view class="servicetitle" style="margin-top: 25rpx">
											线上复购
										</view>
									</view>
								</view>
								<view>
									<!-- v-if="item.isOpen==0" -->
									<view @click="toBuyAgain" class="btn_small" style="margin-top: 20rpx">
										去复购
										<image style="width: 20rpx; height: 20rpx"
											src="../../static/images/write_icon.png"></image>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			<!-- 登录后没有数据 -->
			<view class="noDateboday" v-else>
				<view class="noDate">
					<image src="../../static/images/icon_lack_message@2x.png"></image>
					<view>暂无绑定药店</view>
				</view>
			</view>
			<!-- 优惠券列表 -->
			<view v-if="activeList.length > 0" class="activeList" hover-class="none" hover-stop-propagation="false">
				<view>
					<!-- <view v-if="current == index"> -->
					<view class="service" style="margin-top: -5rpx">
						<view class="icon_line_green"></view>
						<view style="margin-left: 30rpx">优惠券</view>
					</view>
					<view class="couponCard" v-for="(activeInfo, index) in activeList" :key="index">
						<view style="
                                        display: flex;
                                        justify-content: space-between;
                                    ">
							<view>
								<span class="couponType">{{
                                    activeType[activeInfo.activityType] ||
                                    '平台券'
                                }}</span>
								<div class="disFlex">
									<span>
										<span class="danwei">￥</span>
										<span class="money">{{
                                            activeInfo.useMoney || 0
                                        }}</span>
									</span>
									<span class="manjian">
										满{{ activeInfo.freeMoney }}减{{
                                            activeInfo.useMoney
                                        }}</span>
								</div>
								<view class="haveCount" hover-class="none" hover-stop-propagation="false">
									有效期：
								</view>
								<view class="haveCount" hover-class="none" hover-stop-propagation="false">
									{{ activeInfo.startTime }}-{{ activeInfo.endTime }}
								</view>
							</view>

							<view>
								<!-- <view @click="toUse" class="btn_small" style="margin-top: 52rpx">
                                    去使用
                                    <image style="width: 20rpx; height: 20rpx" src="../../static/images/write_icon.png"></image>
                                </view> -->
								<button :disabled="activeInfo.flag == 2" @click="toOpen(activeInfo)" class="btn_small"
									style="margin-top: 32rpx">
									<!--  v-show="(isShowCoupon.includes(orderValue))" -->
									展 码
									<image style="width: 20rpx; height: 20rpx" src="../../static/images/write_icon.png">
									</image>
								</button>
							</view>
						</view>
					</view>

					<!-- </view> -->
				</view>
			</view>
		</view>

		<!--没有登录，先显示样式  -->
		<view v-if="!isLogin">
			<view class="service" style="margin-top: 440rpx">
				<view class="icon_line_green"></view>
				<view style="margin-left: 30rpx">药店服务</view>
			</view>
			<view class="servicecard">
				<view style="display: flex; justify-content: space-between">
					<view style="display: flex">
						<view>
							<image class="img_icon" src="../../static/images/icon_h_jia@2x.png"></image>
						</view>
						<view class="service_content">
							<view style="margin-top: 5rpx" class="servicetitle">
								用药咨询
							</view>
							<view style="margin-top: 15rpx">24小时用药咨询服务</view>
						</view>
					</view>
					<view>
						<view @click="toLogin" class="btn_small" style="margin-top: 20rpx">
							去登录
						</view>
					</view>
				</view>
			</view>
			<view class="servicecard">
				<view style="display: flex; justify-content: space-between">
					<view style="display: flex">
						<view>
							<image class="img_icon" src="../../static/images/icon_h_shen@2x.png"></image>
						</view>
						<view class="service_content">
							<view class="servicetitle" style="margin-top: 25rpx">
								线上复购
							</view>
						</view>
					</view>
					<view>
						<view @click="toLogin" class="btn_small" style="margin-top: 20rpx">
							去登录
						</view>
					</view>
				</view>
			</view>
		</view>

		<hover-ball v-if="listPhone.length > 0" :listPhone="listPhone" />
		<!-- 展码二维码 -->
		<uni-popup ref="openPopup" :mask-click="false" background-color="#fff">
			<view class="popup-content">

				<ayQrcode ref="qrcode" :url="url" :height="180" :width="170"></ayQrcode>
				<!-- <yz-qr ref="qrPath" 
                :text="abcde"
                :size="size" :colorDark="colorDark" 
                :colorLight="colorLight">
            </yz-qr> -->
			</view>
			<view class="openPopImg" hover-class="none" hover-stop-propagation="false">
				<image class="openPopImage" src="../../static/images/closeBtn.png" @click="closeOpen"> </image>
			</view>

		</uni-popup>
		<!-- <button @click="gotoHaoran">去浩然小程序</button> -->
		<!-- <button @click="todoctor" class="btns">医生列表</button> -->
		<!-- <button @click="toMy" class="btns">去购药</button> -->
		<!-- </template> -->

		<syAlert :show="show" @close="show=false" @clickBtn="clickBtn"></syAlert>
	</view>
</template>

<script>
	import {
		userInfo,
		swiperList,
		getAdvertInfo,
		bindDoctor,
		getUserCoupon,
	} from '@/api/user.js';
	import {
		getWeChatListTemp
	} from '@/api/common.js';
	import {
		weChatListTempSet
	} from '@/utils/SubscribeMessage.js';
	import store from '@/store';
	import hoverBall from '@/components/hover-ball/hover-ball-param.vue';
	import ayQrcode from "@/components/ay-qrcode/ay-qrcode.vue"
	import {
		HTTP_REQUEST_URL
	} from '@/config/app.js';

	import syAlert from '@/components/sy-alert/sy-alert'
	// import DoctorInfo from '@/components/doctorInfo'  //医生列表组件
	export default {
		components: {
			hoverBall,
			ayQrcode,
			syAlert
		},
		data() {
			return {
				//二维码相关参数
				// modal_qr: false,
				url: '', // 要生成的二维码值
				show: false,
				abcde: "",
				// 二维码样式id=3627b825b5b047be99564cbcdd1a0d6c&useMoney=30',
				size: 150,
				colorDark: '#000000',
				colorLight: '#ffffff',

				activeList: [], //优惠券列表
				activeType: {
					0: '平台券',
					1: '商家券',
				},
				listPhone: [], //
				storePhone: '',
				storeInfo: {}, //当前选中的轮播图的具体信息
				marTop: 0,
				scripeTop: 0,
				focusstatus: false,
				listData: [], //列表数据
				current: 0,
				swiperDotIndex: 0,
				mode: 'round',
				tAdvertInfo: '',
				isLogin: false,
				serviceId: 0, // 从路由上(二维码)获取服务人员id
				serviceUid: 0, //缓存中的uid
				idFlag: false, //进入该页面是否带参数
				// userCouponList:[], //优惠券列表

			};
		},
		onShow() {
			console.log('---------------------store.state.app.pointFlag--'+store.state.app.pointFlag);
			
						//当第一次登录后提示，提示后设置为false状态   再次登录重新走
						if (store.state.app.pointFlag ) {
			
			
							 store.commit("pointFlag", false);
			
			
			
							this.show = true;
			
			
			
						} else {
			
						}
			
			let _this = this;
			this.isLogin = this.$store.getters.isLogin || false;
			this.serviceUid = store.state.app.serviceUid;
			// console.log(this.isLogin,'登录是否999----')
			//   扫描医护人员二维码进入首页 判断是否绑定过，没有的话先绑定，绑定了的直接选中
			let ewmUrlParam = '', // 从路由上(二维码)获取服务人员id 
				h5UrlParam = '', //h5公众号中跳转过来的id
				schemeUrl = ''; //优惠券领取成功后scheme链接跳转进来的
			// 登录以后
			if (!this.idFlag) {
				// 只执行一次
				let pagearr = getCurrentPages(); //获取应用页面栈
				let currentPage = pagearr[pagearr.length - 1]; //获取当前页面信息
				let option = currentPage.options; //获取页面传递的信息
				// 从路由上(二维码)获取服务人员id --decodeURIComponent(option.q)
				ewmUrlParam = decodeURIComponent(option.q);
				// h5跳转过来的id
				h5UrlParam = decodeURIComponent(option
					.id) //|| decodeURIComponent(option.doctorId); //'https://syapi.sdhryl.cn/doctor?id=133'
				//优惠券领取成功后scheme链接跳转进来的
				schemeUrl = decodeURIComponent(option.doctorId)
			}
			if (this.isLogin) {
				this.idFlag = true;
				if ((ewmUrlParam && ewmUrlParam != 'undefined') || (h5UrlParam && h5UrlParam != 'undefined') || (
						schemeUrl && schemeUrl != 'undefined')) {
					let serviceIdCode
					let arr = ewmUrlParam.split('?id=');
					// console.log('没走这里', ewmUrlParam)
					if (h5UrlParam != 'undefined') {
						serviceIdCode = h5UrlParam
					} else if (schemeUrl) {
						serviceIdCode = schemeUrl
					}
					_this.$store.commit('SET_SERVICE_UID', _this.serviceIdCode); //将扫码的服务人员ID存到缓存中

					if (arr && arr.length > 1) {
						_this.serviceId = arr[1]; //从二维码路径中拿到的uid
						serviceIdCode = _this.serviceId; //扫码获取的医生id，如果没有扫码直接进入首页，获取缓存中的uid
					}

					if (serviceIdCode != 'undefined') {
						_this.$store.commit('SET_SERVICE_UID', _this.serviceId); //将扫码的服务人员ID存到缓存中

						// //如果扫码医生id存在
						this.bindDoctor(serviceIdCode)
					}
				} else {
					this.getDoctorList(); //获取服务人员列表
					// 查询用户信息--主要是用户头像--聊天记录需要
					this.getUserInfo();
					//查询微信订阅消息模板
					//检查缓存是否有模板，如果有不处理，如果没有缓存模板
					weChatListTempSet()
						.then((res) => {})
						.catch((err) => {
							console.log(err);
						});
				}
				// 优惠券列表
				this.getUserCoupons();
			} else {
				// 未登录
				let arr = ewmUrlParam.split('?id=');
				if (arr[1]) {
					// console.log(999, '大于1')
					// 有传参数，跳转到登录页 没传参数留在首页
					this.toLogin();
				}
				if (h5UrlParam != 'undefined') {
					this.toLogin();
				}
				if (schemeUrl) {
					this.toLogin();
				}
			}
		},

		onLoad(options) {
			const res = wx.getMenuButtonBoundingClientRect();
			this.marTop = res.top + 5;



			this.scripeTop = -298; // res.top - 324; //300
			// console.log(options, options.id, '999999----top');
			//	this.$store.commit('LOGIN', {
			//		token: '34b1f8bb-2050-41a9-b869-2a9ea73d3c70' // 'token: 'c5792e67-6644-4a22-8a25-85bf302d8402''
			//	});
			//	this.$store.commit('SETUID', 133);
			// //查询微信订阅消息模板
			// this.weChatListTemp();
			if (this.$store.getters.isLogin) {
				//查询缓存最新模板
				weChatListTempSet(1)
					.then((res) => {})
					.catch((err) => {
						console.log(err);
					});
			}
		},
		onPullDownRefresh() {
			this.isLogin = this.$store.getters.isLogin;
			if (this.$store.getters.isLogin) {
				this.getDoctorList();
				//查询微信订阅消息模板
				// this.weChatListTemp();
				//查询缓存最新模板
				weChatListTempSet(1)
					.then((res) => {})
					.catch((err) => {
						console.log(err);
					});
				this.getAdvertInfos();
				// 查询用户信息--主要是用户头像--聊天记录需要
				this.getUserInfo();
			}
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 1000);
		},
		methods: {
			clickBtn(res) {


				console.log('--------------' + res);

				if (res === 0) {



					console.log('--------------' + res);

					wx.navigateToMiniProgram({
							shortLink: '#小程序://农行微服务/KOcVm3RwjxDjQgz',


							envVersion: 'release', // develop:开发版，trial体验版，release正式版
						})
						.catch((err) => {
							uni.showToast({
								title: err,
								icon: 'none',
								duration: 3000,
							})
						})
				} else {



					let url = encodeURIComponent(JSON.stringify(
						'https://mp.weixin.qq.com/s?__biz=Mzg3OTcyNzI5Nw==&mid=2247485745&idx=1&sn=3bfe1b53b414f797068e254e0fce4a3f'
					));

					// 保留当前页面跳转到支付页面
					uni.navigateTo({
						url: `/pagesSub/homePage/prescribing/webView?url=${url}&type=${0}`, //res.data,
					});
				}






				this.show = false;




			},
			// 展示二维码
			showQrcode() {
				let _this = this;
				uni.showLoading({
					title: '加载中',
				})
				this.$refs.openPopup.open()
				setTimeout(function() {
					_this.$refs.qrcode.crtQrCode()
					uni.hideLoading()
				}, 500)
			},

			// 关闭展码二维码
			closeOpen() {
				this.$refs.openPopup.close()
				// 关闭后重新查询优惠券列表
				this.getUserCoupons();
			},
			// 打开展码
			toOpen(item) {
				this.url = this.url || JSON.stringify(item
					.qrCodeContent
				) // `couponId=${item.qrCodeContent.couponId}&couponPrice=${item.qrCodeContent.couponPrice}&uid=${item.qrCodeContent.uid}&userName=${item.qrCodeContent.userName || ''}`
				this.showQrcode()
			},
			// 绑定医生
			bindDoctor(serviceIdCode) {
				//如果扫码医生id存在
				bindDoctor(serviceIdCode).then((res) => {
						if (res.code == 200) {
							this.getDoctorList(); //获取服务人员列表
							this.getUserInfo();
						}
					})
					.catch((err) => {
						console.log(err);
						this.$util.Tips({
							title: err,
							icon: 'none',
						});
					});
			},
			getUserCoupons() {
				getUserCoupon()
					.then((res) => {
						// console.log(res, '优惠券列表999');
						this.activeList = res.data;
					})
					.catch((err) => {
						this.$util.Tips({
							title: err,
							icon: 'none',
						});
						console.log(err);
					});
			},
			// 使用优惠券，
			toUse() {
				uni.switchTab({
					url: '/pages/homePage/shopList',
				});
			},
			isLoginToBind(serviceId) {
				let _this = this;
				let serviceIdCode = serviceId; //扫码获取的医生id，如果没有扫码直接进入首页，获取缓存中的uid
				if (serviceIdCode > 0) {
					_this.$store.commit('SET_SERVICE_UID', serviceId); //将扫码的服务人员ID存到缓存中
					//如果扫码医生id存在
					this.bindDoctor(serviceIdCode)

				}
			},

			toLogin() {
				uni.navigateTo({
					url: '/pagesSub/index/index',
				});
			},
			// 查询用户信息
			getUserInfo() {
				let serviceUidCache = store.state.app.serviceUid;
				// console.log(serviceUidCache, '查询用户信息缓存中的医生id---');
				userInfo(serviceUidCache)
					.then((res) => {
						// this.info = res.data;
						this.$store.commit('SET_USER_PHOTO', res.data.avatar); //存一下用户头像
						// console.log(this.info, '获取省err');
					})
					.catch((err) => {
						console.log(err, '获取省err');
					});
			},
			// 获取广告位
			getAdvertInfos() {
				getAdvertInfo()
					.then((res) => {
						// console.log("*****广告位###",JSON.stringify(res.data))
						this.tAdvertInfo = res.data;
					})
					.catch((err) => {
						console.log('111错误#', err);
						// if(err.code==401){
						//    this.toLogin()
						// }
					});
			},
			weChatListTemp() {
				let _this = this;
				getWeChatListTemp()
					.then((res) => {
						// console.log('getWeChatListTemp---',res);
						if (res && res.data && res.data.length > 0) {
							// let tempMap = new Map();
							let tempMap = {};
							res.data.forEach((item, index) => {
								let name = item.name;
								let templateId = item.templateId;
								// console.log('templateId----',name,templateId)
								if (name && name.length > 0) {
									// tempMap.set(name,templateId);
									tempMap[name] = templateId;
								}
							});
							this.$store.commit('SET_TEMP', JSON.stringify(tempMap));
							let temp = store.state.app.temp;
							// console.log('已缓存的模板列表---',temp);
						}
					})
					.catch((err) => {
						console.log(err);
					});
			},
			// 点击某个药店
			clickItem(e) {
				this.swiperDotIndex = e;
				let curr = e;
				this.setState(curr);
			},
			// 切换药店

			change(e) {
		 
				// console.log("444444", e)
				this.current = e.detail.current;
				let curr = e.detail.current;
				this.swiperDotIndex = this.current = e.detail.current;
				this.setState(curr);
			},

			setState(curr) {
				let doctorIdChange = this.listData[curr].doctorId;
				let type = this.listData[curr].type; //获取到绑定药店的角色
				let storeId = this.listData[curr].storeId; //获取到绑定药店id
				let storeName = this.listData[curr].storeName; // 获取绑定药店名称
				this.storeInfo = this.listData[curr];
				// console.log(doctorIdChange, storeId, '切换后的医生id,,storeId');
				this.$store.commit('SET_SERVICE_UID', doctorIdChange);
				this.$store.commit('SET_STORETYPE', type); //角色 1：医生 5：服务人员
				this.$store.commit('SET_STOREID', storeId); //药店id
				this.$store.commit('SET_STORENAME', storeName); //药店id

				this.storePhone = this.listData[curr].storePhone;
				// let serviceUidCache = store.state.app.serviceUid;
				// console.log(serviceUidCache, '修改后111，缓存中的医生id')
			},
			goto(url, checkStatus) {
				uni.navigateTo({
					url: url,
				});
			},
			// todoctor() {
			//     uni.navigateTo({
			//         url: '/pages/homePage/doctorList',
			//     });
			// },
			toBuyAgain() {
				// this.goto('./doctorPage')
				uni.navigateTo({
					url: '/pagesSub-My/my/againOrder',
				});
			},
			tofreepage() {
				let info = encodeURIComponent(JSON.stringify(this.storeInfo));

				// 医生
				uni.navigateTo({
					url: `/pagesSub/homePage/prescribing/serviceChoosePeople?serviceInfo=${info} `, //跳转到选择就诊人
				});
				//   uni.navigateTo({
				//     url: `/pagesSub/service/chat?item=${info} `, //跳转到聊天
				//   })
				// }
			},
			gotoPre() {
				uni.navigateTo({
					url: '/pagesSub/homePage/prescribing/choosePeople',
				});
			},
			medicalList() {
				if (this.$store.getters.isLogin) {
					uni.navigateTo({
						url: '/pages/homePage/searchList',
					});
				} else {
					this.toLogin();
					// uni.navigateTo({
					//     url: '/pagesSub/index/index',
					// });
				}
			},
			getDoctorList: function() {
				let _this = this;
				//获取当前绑定的医生缓存中
				let serviceUidCache = store.state.app.serviceUid;
				// console.log(serviceUidCache, 222222222222, '查医生列表 缓存中的医生id---');
				swiperList()
					.then((res) => {
						res.data.forEach((item, index) => {
							// console.log(index, item, _this.swiperDotIndex, _this.current, 'pppp999---');
							let doctorIdItem = item.doctorId;
							if (doctorIdItem == serviceUidCache) { // 缓存中和当前绑定的是同一个
								_this.storeInfo = item || {};
								// console.log(_this.storeInfo, '当前缓存的和初次绑定时当前选中的服务人员信息---')
								_this.swiperDotIndex = _this.current = index;
								_this.storePhone = item.storePhone; // ['15306462812', '0531-26584545']; //
								_this.listPhone = item.listPhone;
								_this.$store.commit(
									'SET_STOREID',
									_this.storeInfo.storeId
								); //初次绑定后将storeId放入缓存
								_this.$store.commit(
									'SET_STORENAME',
									_this.storeInfo.storeName
								); //初次绑定后将storeId放入缓存
							}
						});
						_this.listData = res.data;
						let firstDoctorId = res.data[0].doctorId;
						let type = res.data[0].type;
						let storeId = res.data[0].storeId;
						let storeName = res.data[0].storeName;
						//缓存没有默认设置第一个
						if (!serviceUidCache && res.data.length > 0) {
							_this.$store.commit('SET_SERVICE_UID', firstDoctorId); //缓存没有默认设置第一个
							_this.$store.commit('SET_STORETYPE', type); //角色 1：医生 5：服务人员
							_this.$store.commit('SET_STOREID', storeId); //药店id
							_this.$store.commit('SET_STORENAME', storeName); //药店id

							_this.storePhone = res.data[0].storePhone;

						}
					})
					.catch((err) => {
						this.$util.Tips({
							title: err,
							icon: 'none',
						});
						console.log(err);
					});
			},
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #ffffff !important;
	}

	.header {
		position: absolute;
		z-index: 999;
		width: 100%;
		text-align: center;
	}

	.header>.headerTitle {
		color: #ffffff;
		font-size: 37rpx;
	}

	.bg_image {
		width: 100%;
		position: relative;
		height: 700rpx;
		/* top: -25rpx; */
	}

	.inputStyle_border {
		position: relative;
		left: 5%;
		width: 90%;
	}

	.inputStyle {
		border-radius: 40rpx;
		height: 65rpx;
		line-height: 65rpx;
		background-color: #ffffff;
		text-align: center;
		font-size: 30rpx;
	}

	/* 轮播样式 */
	.swiperCard {
		background-color: #ffffff;
		border-radius: 15rpx;
	}

	.title {
		background-color: #f9f1da;
		color: #736149;
		padding: 10rpx 20rpx;
		font-size: 33rpx;
		border-top-left-radius: 15rpx;
		border-top-right-radius: 15rpx;
	}

	.doctorheader {
		width: 190rpx;
		height: 200rpx;
		padding: 15rpx;
		padding-right: 0;
	}

	.doctorheader image {
		max-width: 100%;
		max-height: 100%;
		border-radius: 10rpx;
	}

	.doctorInfo {
		font-size: 30rpx;
		padding: 22rpx 10rpx;
	}

	/deep/.uni-swiper__dots-box.data-v-77b53eff {
		display: none !important;
	}

	.swiper-item {
		width: 630rpx;
		height: 325rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.swiper-item-side {
		width: 630rpx;
		height: 325rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.image-container {
		width: 750rpx;
		height: 350rpx;
	}

	.item-img-side {
		width: 630rpx;
		height: 290rpx;
		border-radius: 14rpx;
		animation: to-mini 0.3s;
	}

	.item-img {
		width: 630rpx;
		height: 300rpx;
		border-radius: 14rpx;
		animation: to-big 0.3s;
	}

	.positions {
		margin-top: -350rpx;
	}

	.icon_line_green {
		height: 35rpx;
		padding: 4rpx;
		border-top-right-radius: 40rpx;
		border-bottom-right-radius: 40rpx;
		background-color: #4fcbbf;
		position: absolute;
		left: 0;
	}

	.service {
		display: flex;
		margin-top: 10rpx;
		font-size: 33rpx;
		font-weight: bold;
		letter-spacing: 3rpx;
	}

	.servicecard {
		padding: 15rpx 30rpx;
		margin: 20rpx 30rpx 10rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
	}

	.img_icon {
		width: 65rpx;
		height: 65rpx;
		margin-top: 15rpx;
	}

	.service_content {
		margin-left: 30rpx;
		font-size: 29rpx;
	}

	.servicetitle {
		font-size: 31rpx;
		font-weight: bold;
		letter-spacing: 3rpx;
	}

	.btn_small {
		font-size: 27rpx;
		color: #ffffff;
		padding: 2rpx 15rpx;
		text-align: center;
		border-radius: 40rpx;
		background: -webkit-linear-gradient(#77e2a4, #4ccdbc);
		height: 50rpx;
		line-height: 50rpx;
	}

	.btn_small_gary {
		font-size: 27rpx;
		color: #6e6e6e;
		padding: 2rpx 15rpx;
		text-align: center;
		border-radius: 40rpx;
		background: #e6e6e5;
		height: 50rpx;
		line-height: 50rpx;
	}

	.noDateboday {
		position: absolute;
		width: 90%;
		height: 360rpx;
		margin-left: 5%;
		margin-top: 33rpx;
	}

	.noDate {
		width: 100%;
		/* height: 360rpx; */
		height: 380rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		text-align: center;
		font-size: 33rpx;
		color: #9c9b9b;
	}

	.noDate image {
		width: 280rpx;
		height: 280rpx;
	}

	.go_login {
		width: 45%;
		margin: 0 auto;
	}

	.go_login_btn {
		border-radius: 60rpx;
		font-size: 34rpx;
		line-height: 2;
		/* padding: 0 -3rpx; */
		padding-left: 0rpx;
		padding-right: 0rpx;
		border: 1px solid #4ccdbc;
		color: #4dcbbd;
	}

	.item-img.data-v-0ff7806c {
		height: 283rpx !important;
	}

	.btns {
		/* width: 100%;
  position: absolute;
  bottom: -230rpx;
  left: 0; */
	}

	.activeList {
		padding-bottom: 10rpx;
	}

	.couponCard {
		padding: 10rpx 30rpx;
		margin: 10rpx 30rpx;
		border-radius: 20rpx;
		background: linear-gradient(to right, #70C6FC, #FD4AFD);
		height: 200rpx;
	}

	.couponType {
		background: #4ccdbc;
		color: #ffffff;
		font-size: 12px;
		padding: 0 10rpx;
		border-radius: 10rpx;
		position: relative;
		top: -17rpx;
		left: -24rpx;
	}

	.disFlex {
		display: flex;
	}

	.danwei {
		color: red; // #4ccdbc;
		font-size: 54rpx;
	}

	.money {
		color: red; // #4ccdbc;
		font-size: 50rpx;
		display: inline-block;
		border-right: 1px dashed #cccccc;
		padding-right: 20rpx;
	}

	.manjian {
		font-size: 38rpx;
		color: red; // #4ccdbc;
		margin-left: 20rpx;
		margin-top: 20rpx;
	}

	.haveCount {
		margin: 10rpx auto 0;
		font-size: 12px;
		color: #ffffff; // #9c9b9b;
	}

	.openPopImg {
		margin: 40rpx auto 0;
		width: 40px;
	}

	.openPopImage {
		width: 100%;
		height: 40px;
		z-index: 99;
	}

	.popup-content {
		margin: 20px;
	}
</style>